package com.net.xpay.common.domain.stat;

import com.net.common.domain.CommonDomain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 后台用户经营数据实时统计表
 */
@Getter
@Setter
@NoArgsConstructor
public class UserRealTimeStat extends CommonDomain {
    /**
     * 基础信息
     */
    @ApiModelProperty(notes = "用户id")
    private Long userId;

    @ApiModelProperty(notes = "合伙人id")
    private Long partnerId;

    @ApiModelProperty(notes = "更新时间")
    private LocalDateTime updateTime;

    /**
     * 统计数据(总)
     */

    @ApiModelProperty(notes = "服务费充值金额 单位元 保留2小数")
    private BigDecimal serviceChargeFee;

    @ApiModelProperty(notes = "总转账笔数")
    private Long totalCount;

    @ApiModelProperty(notes = "总转账成功笔数")
    private Long totalSuccessCount;

    @ApiModelProperty(notes = "总转账失败笔数")
    private Long totalFailCount;

    @ApiModelProperty(notes = "单笔超过500元 总转账成功笔数")
    private Long totalSuccessSingleVeryCount;

    @ApiModelProperty(notes = "单笔超过500元 总转账失败笔数")
    private Long totalFailSingleVeryCount;

    @ApiModelProperty(notes = "单笔超过10000元 总转账成功笔数")
    private Long totalSuccessLargeCount;

    @ApiModelProperty(notes = "总服务费支出 单位元 保留2小数")
    private BigDecimal totalServicePrice;

    @ApiModelProperty(notes = "总转账金额 单位元 保留2小数")
    private BigDecimal totalTransAmount;

    @ApiModelProperty(notes = "总转账成功金额 单位元 保留2小数")
    private BigDecimal totalSuccessTransAmount;

    @ApiModelProperty(notes = "总转账失败金额 单位元 保留2小数")
    private BigDecimal totalFailTransAmount;

    @ApiModelProperty(notes = "总服务费总收益 单位元 保留2小数")
    private BigDecimal totalBenefit;

    /**
     * 批量有密统计数据
     */
    @ApiModelProperty(notes = "批量有密转账笔数")
    private Long payTransCount;

    @ApiModelProperty(notes = "批量有密转账成功笔数")
    private Long payTransSuccessCount;

    @ApiModelProperty(notes = "批量有密转账失败笔数")
    private Long payTransFailCount;

    @ApiModelProperty(notes = "批量有密付款超过500万的账户数")
    private Long payTransVeryAlipayUserCount;

    @ApiModelProperty(notes = "单笔超过500元 批量有密转账成功笔数")
    private Long payTransSuccessSingleVeryCount;

    @ApiModelProperty(notes = "单笔超过10000元 批量有密转账成功笔数")
    private Long payTransSuccessLargeCount;

    @ApiModelProperty(notes = "单笔超过500元 批量有密转账失败笔数")
    private Long payTransFailSingleVeryCount;

    @ApiModelProperty(notes = "批量有密转账金额 单位元 保留2小数")
    private BigDecimal payTransAmount;

    @ApiModelProperty(notes = "批量有密转账成功金额 单位元 保留2小数")
    private BigDecimal payTransSuccessAmount;

    @ApiModelProperty(notes = "批量有密转账失败金额 单位元 保留2小数")
    private BigDecimal payTransFailAmount;

    @ApiModelProperty(notes = "批量有密服务费支出 单位元 保留2小数")
    private BigDecimal payTransServicePrice;

    @ApiModelProperty(notes = "平台服务费总收益(批量有密) 单位元 保留2小数")
    private BigDecimal totalPayTransBenefit;
    /**
     * 安全发统计数据
     */
    @ApiModelProperty(notes = "安全发转账笔数")
    private Long safePayTransCount;

    @ApiModelProperty(notes = "安全发成功转账笔数")
    private Long safePayTransSuccessCount;

    @ApiModelProperty(notes = "安全发失败转账笔数")
    private Long safePayTransFailCount;

    @ApiModelProperty(notes = "安全发款超过500万的账户数")
    private Long safePayTransVeryAlipayUserCount;

    @ApiModelProperty(notes = "单笔超过500元 安全发成功转账笔数")
    private Long safePayTransSuccessSingleVeryCount;

    @ApiModelProperty(notes = "单笔超过500元 安全发失败转账笔数")
    private Long safePayTransFailSingleVeryCount;

    @ApiModelProperty(notes = "单笔超过10000元 安全发成功转账笔数")
    private Long safePayTransSuccessLargeCount;

    @ApiModelProperty(notes = "安全发转账金额 单位元 保留2小数")
    private BigDecimal safePayTransAmount;

    @ApiModelProperty(notes = "安全发转账成功金额 单位元 保留2小数")
    private BigDecimal safePayTransSuccessAmount;

    @ApiModelProperty(notes = "安全发转账失败金额 单位元 保留2小数")
    private BigDecimal safePayTransFailAmount;

    @ApiModelProperty(notes = "安全发服务费支出 单位元 保留2小数")
    private BigDecimal safePayTransServicePrice;

    @ApiModelProperty(notes = "平台服务费总收益(安全发) 单位元 保留2小数")
    private BigDecimal totalSafePayTransBenefit;


    public static UserRealTimeStat getInstance(Long userId,LocalDateTime time) {
        UserRealTimeStat stat = new UserRealTimeStat();

        stat.setUpdateTime(time);
        stat.setUserId(userId);
        stat.setServiceChargeFee(new BigDecimal("0.00"));
        stat.setTotalCount(0L);
        stat.setPayTransCount(0L);
        stat.setSafePayTransCount(0L);
        stat.setTotalSuccessCount(0L);
        stat.setPayTransSuccessCount(0L);
        stat.setSafePayTransSuccessCount(0L);
        stat.setTotalFailCount(0L);
        stat.setTotalSuccessSingleVeryCount(0L);
        stat.setTotalFailSingleVeryCount(0L);
        stat.setPayTransVeryAlipayUserCount(0L);
        stat.setPayTransSuccessSingleVeryCount(0L);
        stat.setPayTransFailSingleVeryCount(0L);
        stat.setSafePayTransVeryAlipayUserCount(0L);
        stat.setSafePayTransSuccessSingleVeryCount(0L);
        stat.setSafePayTransFailSingleVeryCount(0L);
        stat.setPayTransFailCount(0L);
        stat.setSafePayTransFailCount(0L);
        stat.setTotalServicePrice(new BigDecimal("0.00"));
        stat.setPayTransServicePrice(new BigDecimal("0.00"));
        stat.setSafePayTransServicePrice(new BigDecimal("0.00"));
        stat.setTotalTransAmount(new BigDecimal("0.00"));
        stat.setPayTransAmount(new BigDecimal("0.00"));
        stat.setSafePayTransAmount(new BigDecimal("0.00"));
        stat.setTotalSuccessTransAmount(new BigDecimal("0.00"));
        stat.setPayTransSuccessAmount(new BigDecimal("0.00"));
        stat.setSafePayTransSuccessAmount(new BigDecimal("0.00"));
        stat.setTotalFailTransAmount(new BigDecimal("0.00"));
        stat.setPayTransFailAmount(new BigDecimal("0.00"));
        stat.setSafePayTransFailAmount(new BigDecimal("0.00"));
        stat.setTotalBenefit(new BigDecimal("0.00"));
        stat.setTotalPayTransBenefit(new BigDecimal("0.00"));
        stat.setTotalSafePayTransBenefit(new BigDecimal("0.00"));

        return stat;
    }
}
